package com.xja.controller;

import com.xja.entity.Food;
import com.xja.entity.PageBean;
import com.xja.service.FoodService;
import org.apache.dubbo.config.annotation.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author 翁
 * @date 2022/4/14 11:47
 */
@Controller
@RequestMapping("/food")
public class FoodController {
    private Logger logger = LoggerFactory.getLogger(FoodController.class);
    @Reference(url = "dubbo://localhost:20882")
    private FoodService foodService;

    @RequestMapping("foodList")
    public String foodList(Integer npage, Model model) {
        logger.info("调用了用户管理的方法：");
        PageBean<Food> foodPageBean =foodService.selectByFind(1);
        model.addAttribute("pageInfo",foodPageBean);
        model.addAttribute("foodList",foodPageBean.getContentList());
        return "/index.html";
    }
}
